﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DEMO3.DTO;
using System.Data.SqlClient;

namespace DEMO3.DAO
{
    class TheLoaiPhimDAO
    {
        public DataTable Get()
        {
            DataProvider test = new DataProvider();
            return test.ExcuteQuery("GET_THELOAIPHIM", null);
        }

        public bool Add(TheLoaiPhimDTO dto)
        {
            DataProvider test = new DataProvider();
            SqlParameter[] arrpara = new SqlParameter[2];
            arrpara[0] = new SqlParameter("MaTheLoai", dto.MaTheLoai);
            arrpara[1] = new SqlParameter("TenTheLoai", dto.TenTheLoai);
            return test.ExcuteNonQuery("ADD_THELOAIPHIM", arrpara);
        }
        public bool Delete(TheLoaiPhimDTO dto)
        {
            DataProvider test = new DataProvider();
            SqlParameter[] arrpara = new SqlParameter[1];
            arrpara[0] = new SqlParameter("MaTheLoai", dto.MaTheLoai);
            return test.ExcuteNonQuery("DELETE_THELOAIPHIM", arrpara);
        }
        public bool Update(TheLoaiPhimDTO dto)
        {
            DataProvider test = new DataProvider();
            SqlParameter[] arrpara = new SqlParameter[2];
            arrpara[0] = new SqlParameter("MaTheLoai", dto.MaTheLoai);
            arrpara[1] = new SqlParameter("TenTheLoai", dto.TenTheLoai);
            return test.ExcuteNonQuery("UPDATE_THELOAIPHIM", arrpara);
        }
    }
}
